#include <iostream>
#include <cstdio>
#include <cstring>
#include <utility>
#include <vector>
#include <algorithm>
#define fore(i, a, b) for(int i = a; i <= b; i++)
#define Fore(i, a, b) for(int i = a; i < b; i++)
#define li long long
#define pii pair<int, int>
#define pil pair<int, li>
#define MP make_pair
using namespace std;

const int MAXN = 2005;

inline int input()
{
    char c = getchar(); int o; bool f = 0;
    while(c > 57 || c < 48) f|= (c == '-'), c = getchar();
    for(o = 0; c > 47 && c < 58; c = getchar())
        o = (o << 1)+(o << 3)+c - 48;
    return f ? -o : o;
}

struct node
{
    int x, y, c;
    node(int x = 0, int y = 0, int c = 0):x(x),y(y),c(c){}
}P[MAXN];

int x[MAXN], y[MAXN], v[MAXN][MAXN];

bool compX(node A, node B)
{
    return A.x < B.x;
}
bool compY(node A, node B)
{
    return A.y < B.y;
}

struct t
{
    int lsum, rsum, tot_sum, max_sum;
}tree[4 * MAXN];

void update(int o, int l, int r, int i, int c)
{
    if(i > r || i < l)return;
    if(l == r){
        tree[o].lsum += c;
        tree[o].rsum += c;
        tree[o].tot_sum += c;
        tree[o].max_sum += c;
        return;
    }
    int mid = (l + r) >> 1;
    update(o << 1, l, mid, i, c);
    update(o << 1 | 1, mid + 1, r, i, c);
    t &f = tree[o], &ls = tree[o << 1], &rs = tree[o << 1 | 1];
    f.lsum = max(ls.lsum, ls.tot_sum + rs.lsum);
    f.rsum = max(rs.rsum, rs.tot_sum + ls.rsum);
    f.tot_sum = ls.tot_sum + rs.tot_sum;
    f.max_sum = max(max(max(ls.rsum + rs.lsum, ls.max_sum), max(rs.max_sum, f.lsum)), f.rsum);
}

void DP(int n, const int MAX_Y)
{
    int ans = 0;
    sort(P + 1, P + n + 1, compX);
    fore(i, 1, n)
    {
        memset(tree, 0, sizeof(tree));
        if(i > 1 && P[i].x == P[i - 1].x) continue;
        for(int j = i; j <= n; j++)
        {
            int y = P[j].y, c = P[j].c;
            update(1, 1, MAX_Y, y, c);
            if(j < n && P[j].x == P[j + 1].x) continue;
            int temp = tree[1].max_sum;
            ans = max(ans, temp);
        }
    }
    printf("%d", ans);
}

int main()
{
    // freopen("In.txt", "r", stdin);
    int n = input(), m;
    x[0] = y[0] = - 1e9 - 5;
    fore(i, 1, n)
    {
        x[i] = input(); y[i] = input();
        P[i] = node(x[i], y[i], 1);
    }
    m = input();
    fore(i, n + 1, n + m)
    {
        x[i] = input(); y[i] = input();
        P[i] = node(x[i], y[i], -1);
    }
    sort(P + 1, P + n + m + 1, compX);
    sort(x + 1, x + n + m + 1);
    fore(i, 1, n + m)
    {
        if(x[i] == x[i - 1])P[i].x = P[i - 1].x;
        else P[i].x = P[i - 1].x + 1;
    }
    sort(P + 1, P + n + m + 1, compY);
    sort(y + 1, y + n + m + 1);
    fore(i, 1, n + m)
    {
        if(y[i] == y[i - 1])P[i].y = P[i - 1].y;
        else P[i].y = P[i - 1].y + 1;
    }
    int c1 = input(), c2 = -input();
    fore(i, 1, n + m)
        P[i].c = P[i].c == 1 ? c1 : c2;
    DP(n + m, P[n + m].y);
    return 0;
}